#include "actionops.h"
#include "kmglang_en.h"
#include "dfon_comdef.h"

#define FEATURE_KWC_JAVA
#define FEATURE_KWC_JAVA_EXT
#include "KWCJavaExt.h"
#include "dfon_if_settings.h"

boolean ActionOps_HandleAction(MGallery *mgallery, CatInfo *catInfo, NodeAction *action)
{
    IKWCJava *pJava = NULL;
	UTIL_HISTORY_DATA histData;

	switch(action->id)
	{
	case IDS_GET_MORE_RINGERS:
	case IDS_GET_MORE_GRAPHICS:
		ZEROAT(&histData);
		histData.sender = AEECLSID_DIFFON_HELPER_LIB;
		histData.target = AEECLSID_BROWSER_APP;
		histData.IFSymbol = 0;
		if(action->id == IDS_GET_MORE_RINGERS)
			STRCPY((char*)histData.pBuf, "http://homepage/ringtones");
		else
			STRCPY((char*)histData.pBuf, "http://homepage/graphics");
		DFON_IUTILLIB_SetHistory(mgallery->utils, "KWC_BROWSER_APP", &histData);
#ifdef FEATURE_APP_UP7BROWSER
		ISHELL_StartApplet(mgallery->shell, AEECLSID_BROWSER_APP);
#endif
		break;
	case IDS_MY_MUSIC:
		ISHELL_StartApplet(mgallery->shell, AEECLSID_MUSICPLAYER);
		break;
	case IDS_MY_GAMES:
		if ( SUCCESS == ISHELL_CreateInstance(mgallery->shell, AEECLSID_KWC_JAVA, (void **)&pJava))
		{
			IKWCJava_LaunchAMSFolder( pJava, KWC_JAVA_AMS_FOLDER_TYPE_GAMES);
			RELEASEIF(pJava);
		}
		break;
	case IDS_MY_THEMES:
		ZEROAT(&histData);
		histData.IFSymbol = KWC_IF_SETTINGS_COLOR_THEMES;
		histData.nBufSize = 0;
		histData.sender = AEECLSID_MG;
		histData.target = AEECLSID_DIFFON_SETTINGS;
		DFON_IUTILLIB_SetHistory(mgallery->utils, "DFON_Settings", &histData);
		ISHELL_StartApplet (mgallery->shell,  AEECLSID_DIFFON_SETTINGS);
		break;
	case IDS_MY_OTHER_STUFF:
		if ( SUCCESS == ISHELL_CreateInstance(mgallery->shell, AEECLSID_KWC_JAVA, (void **)&pJava))
		{
			IKWCJava_LaunchAMSFolder( pJava, KWC_JAVA_AMS_FOLDER_TYPE_APPLICATIONS);
			RELEASEIF(pJava);
		}
		break;
	}

	return TRUE;
}